﻿using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using IDAL;
using Model;

namespace DAL
{
    public class AssembleDetailItem : BaseRepository<AssembleDetailItemInfo>, IAssembleDetailItem   
    {
        private const string PARM_ASSEMBLEDETAILITEM_PRODUCTSN = "@ProductSN";
        private const string PARM_ASSEMBLEDETAILITEM_RECORDTIME = "@RecordTime";

        private const string PARM_ASSEMBLEDETAILITEM_BATCHID = "@BatchID";


        public IList<AssembleDetailItemInfo> GetAssembleDetailItembyBatchID(string batchID)
        {
            SqlParameter parm = GetParameter();
            parm.Value = batchID;
            return ExcuteSqlToGetEntities("AssembleDetailItem_selectbyBatchID", parm);
        }


        //-------------------------------------重写超类基础操作---------------------------------------------------------

        public override AssembleDetailItemInfo GetEntityRecord(SqlDataReader rdr)
        {
            AssembleDetailItemInfo pro = new AssembleDetailItemInfo(rdr.GetValue(0).ToString(), rdr.GetValue(1).ToString(), rdr.GetValue(2).ToString()
                , rdr.GetDateTime(3), rdr.GetValue(4).ToString());
            return pro;
        }

        public override SqlParameter GetParameter()
        {
            SqlParameter Parm = new SqlParameter(PARM_ASSEMBLEDETAILITEM_BATCHID, SqlDbType.NVarChar, 50);
            return Parm;
        }
    }
}
